package kz.pdt12.hw.framework;

import kz.pdt12.hw.data.ContactData;
import kz.pdt12.hw.data.GroupData;
import kz.pdt12.hw.utils.SortedListOf;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: raimbek
 * Date: 21.04.13
 * Time: 15:15
 */
public class ApplicationModel {

    private SortedListOf<GroupData> groups;
    private SortedListOf<ContactData> contacts;

    public SortedListOf<GroupData> getGroups() {
        return groups;
    }

    public void setGroups(List<GroupData> groups) {
        this.groups = new SortedListOf<GroupData>(groups);
    }

    public ApplicationModel addGroup(GroupData group) {
        groups.add(group);
        return this;
    }

    public ApplicationModel removeGroup(int index) {
        groups.remove(index);
        return this;
    }

    public SortedListOf<ContactData> getContacts() {
        return contacts;
    }

    public void setContacts(List<ContactData> contacts) {
        this.contacts = new SortedListOf<ContactData>(contacts);
    }

    public ApplicationModel addContact(ContactData contact) {
        contacts.add(contact);
        return this;
    }

    public ApplicationModel removeContact(int index) {
        contacts.remove(index);
        return this;
    }
}
